package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbJsyaqqkbb;
import com.ruoyi.tjbb.service.ISysTjbbJsyaqqkbbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 驾驶员安全情况报表Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/qysjtj/jsyaqqkbb")
public class SysTjbbJsyaqqkbbController extends BaseController
{
    @Autowired
    private ISysTjbbJsyaqqkbbService sysTjbbJsyaqqkbbService;

    /**
     * 查询驾驶员安全情况报表列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:jsyaqqkbb:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbJsyaqqkbb sysTjbbJsyaqqkbb)
    {
        startPage();
        List<SysTjbbJsyaqqkbb> list = sysTjbbJsyaqqkbbService.selectSysTjbbJsyaqqkbbList(sysTjbbJsyaqqkbb);
        return getDataTable(list);
    }

    /**
     * 导出驾驶员安全情况报表列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:jsyaqqkbb:export')")
    @Log(title = "驾驶员安全情况报表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbJsyaqqkbb sysTjbbJsyaqqkbb)
    {
        List<SysTjbbJsyaqqkbb> list = sysTjbbJsyaqqkbbService.selectSysTjbbJsyaqqkbbList(sysTjbbJsyaqqkbb);
        ExcelUtil<SysTjbbJsyaqqkbb> util = new ExcelUtil<SysTjbbJsyaqqkbb>(SysTjbbJsyaqqkbb.class);
        util.exportExcel(response, list, "驾驶员安全情况报表数据");
    }

    /**
     * 获取驾驶员安全情况报表详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:jsyaqqkbb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbJsyaqqkbbService.selectSysTjbbJsyaqqkbbById(id));
    }

    /**
     * 新增驾驶员安全情况报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:jsyaqqkbb:add')")
    @Log(title = "驾驶员安全情况报表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbJsyaqqkbb sysTjbbJsyaqqkbb)
    {
        return toAjax(sysTjbbJsyaqqkbbService.insertSysTjbbJsyaqqkbb(sysTjbbJsyaqqkbb));
    }

    /**
     * 修改驾驶员安全情况报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:jsyaqqkbb:edit')")
    @Log(title = "驾驶员安全情况报表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbJsyaqqkbb sysTjbbJsyaqqkbb)
    {
        return toAjax(sysTjbbJsyaqqkbbService.updateSysTjbbJsyaqqkbb(sysTjbbJsyaqqkbb));
    }

    /**
     * 删除驾驶员安全情况报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:jsyaqqkbb:remove')")
    @Log(title = "驾驶员安全情况报表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbJsyaqqkbbService.deleteSysTjbbJsyaqqkbbByIds(ids));
    }
}
